//
//  SystemMsgTableViewCell.m
//  BaseFrame
//
//  Created by 孟学浩 on 2017/5/11.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "SystemMsgTableViewCell.h"

@interface SystemMsgTableViewCell()

@property (nonatomic,strong) UIImageView *voiceImgView;
@property (nonatomic,strong) UILabel *timeLabel;
@property (nonatomic,strong) UILabel *infoLabel;

@end

@implementation SystemMsgTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
        
        _voiceImgView = [UIImageView new];
        _voiceImgView.image = [UIImage imageNamed:@"trumpet"];
        
        _timeLabel = [UILabel new];
        _timeLabel.font = DEF_FontSize_10;
        _timeLabel.textColor = getColor(mainColor);
        
        _infoLabel = [UILabel new];
        _infoLabel.font = DEF_FontSize_12;
        _infoLabel.numberOfLines = 2;
        
        [self.contentView addSubview:_timeLabel];
        [self.contentView addSubview:_infoLabel];
        [self.contentView addSubview:_voiceImgView];

    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _voiceImgView.frame = CGRectMake(8, 0, 20, 18);
    _voiceImgView.center = CGPointMake(_voiceImgView.centerX, self.height/2.);
    _timeLabel.frame = CGRectMake(SCREEN_WIDTH - 70, 0, 70, self.height);
    _infoLabel.frame = CGRectMake(CGRectGetMaxX(_voiceImgView.frame) + 10, 0, CGRectGetMinX(_timeLabel.frame) - CGRectGetMaxX(_voiceImgView.frame) - 80, self.height);
}

- (void)setDataDictionary:(NSDictionary *)dataDictionary{
    _dataDictionary = dataDictionary;
    NSString *info = @"您于15:02分在萌萌哒的店铺产生了一个订单！";
    _timeLabel.text = @"2017-01-01";
    
    NSMutableParagraphStyle *paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle1 setLineSpacing:6];//调整行间距
    _infoLabel.attributedText = [[NSAttributedString alloc] initWithString:info attributes:@{NSParagraphStyleAttributeName:paragraphStyle1}];
}

@end
